package com.homework;

public class demo05 {
    public static void main(String[] args) {
        //按要求定义数组
        int[] arr = new int[]{21, 25, 26, 28, 29, 50, 48, 47, 45, 44};
        //打印转换前的数组
        System.out.print("转换前：[");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + ",");
        }
        System.out.println("]");
        System.out.print("转换后：[");
        //遍历数组，将数组中的奇数变为原来的2倍
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] % 2 == 1) {
                arr[i] *= 2;
            }
            System.out.print(arr[i] + ",");
        }
        System.out.println("]");
    }
}
